<?php
/** @var IncidenciaController $this */
/** @var Incidencia $model */
$model_tcapacitacion = new TCursocapacitacion('search');
$model_tcapacitacion->unsetAttributes();
$numItem = $model_tcapacitacion->getCapacitacionPersona($model->per_id)->itemCount;
?>
<div class="span8 bio">
    <div style='overflow:auto'  class='grid <?php echo($numItem > 0) ? '' : 'hidden'; ?>'> 

        <?php
        $this->widget('bootstrap.widgets.TbGridView', array(
            'id' => 'capacitacion-grid',
            'type' => 'striped bordered hover advance',
            "template" => "{items}{summary}{pager}",
            'dataProvider' => $model_tcapacitacion->getCapacitacionPersona($model->per_id),
            'columns' => array(
//                    array(
//                        'name' => '#Codigo',
//                        'value' => 'CHtml::link(Util::number_pad($data->id,5), Yii::app()->createUrl("incidencias/incidencia/view",array("id"=>$data->id)))',
//                        'type' => 'raw',
//                    ),
                'crc_nombredlcurso',
                'crc_duracionhoras',
                'crc_areatema',
                'crc_crclocal',
                'per_id',
                'insc_id',
                array(
                    'class' => 'CButtonColumn',
                    'template' => '{update} {delete}',
                    'buttons' => array(
                        'update' => array(
                            'label' => '<button class="btn btn-primary"><i class="icon-pencil"></i></button>',
                            'options' => array('title' => 'Actualizar'),
                            'imageUrl' => false,
                            'visible' => 'Util::checkAccess(array("action_incidencia_update"))'
                        ),
                        'delete' => array(
                            'label' => '<button class="btn btn-danger"><i class="icon-trash"></i></button>',
                            'options' => array('title' => 'Eliminar'),
                            'imageUrl' => false,
                            'visible' => 'Util::checkAccess(array("action_incidencia_delete"))'
                        ),
                    ),
                    'htmlOptions' => array(
                        'width' => '80px'
                    )
                ),
            ),
        ));
        ?>
    </div>

    <?php
    echo ($numItem > 0) ? "<br>" : "";
    $this->widget(
            'bootstrap.widgets.TbButton', array(
        'id' => 'add-capacitacion',
        'label' => ($numItem > 0 ? '' : '<br>') . 'Agregar Capacitaciones/Cursos.',
        'encodeLabel' => false,
        'icon' => $numItem > 0 ? 'plus-sign' : 'icon-fire',
        'htmlOptions' => array(
            'onClick' => 'js:getModal();',
            'class' => $numItem > 0 ? '' : 'empty-portlet',
        ),
            )
    )
    ?>


</div>
